<?php
class ApplypointsController extends Controller{

	public function index(){
		$this->getSmarty();
        // 用户在我们网站买完东西，去amazon结算以后，可以回来填写一下

        if( isset($_SESSION['user'])) {

        }

        $this->smarty->assign("username",$_SESSION['user']['username']);

		$this->smarty->display("user_center/shareorder.tpl");
	}

    /**
     * 接收用户提交申请积分的内容
     */
    public function submitContent(){
        require_once SERVICE . DS . 'ApplypointsService.class.php';
        $this->getSmarty();
        $content = $_POST["content"];
        //从session中获取用户信息
        $user = $_SESSION ['user'];
        $userid = $user['userid'];
        $username=$user['username'];

        $applyPointsService = new ApplypointsService( $this->getDB () );

        $result = $applyPointsService->saveApplyContent($userid,$username,$content);

        $this->smarty->assign("result",$result);

         $this->smarty->display("user_center/shareorder.tpl");
        echo "1";
    }

}